<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css">
    <link href="framework/reset.css" rel="stylesheet">
    <link href="css/payment.css" rel="stylesheet">
    <script src="js/payment.js"></script>
    <script src="js/pageJump.js"></script>
    <script src="https://fastly.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <title>超级会员支付</title>
</head>
<body>
    <div class="wrapper" id="app">

        <!-- header部分 -->
        <header>
            <p>在线支付</p>
        </header>

        <!-- 订单信息部分 -->
        <h3>订单信息：</h3>
        <div class="order-info" >
            <p>
                开通会员，vivo50 <br>
                
            </p>
            <p>￥50</p>
        </div>

        
        <!-- 支付方式部分 -->
        <ul class="payment-type">
            <li @click="payWay=0">
                <img src="https://gw.alipayobjects.com/zos/bmw-prod/f466695f-f426-4e79-ae69-ecdf64a03c71.svg">
                <i class="fa fa-check-circle" v-if="payWay==0"></i>
            </li>
            <li @click="payWay=1">
                <img src="https://td.cdn-go.cn/enterprise_payment/v0.0.9/logo.png">
                <i class="fa fa-check-circle" v-if="payWay==1"></i>
            </li>
        </ul>
        <div class="payment-button">
            <button @click="openMembershipByUserId">确认支付</button>
        </div>
    </div>
    <script>
        var param=getRequest()
        var path=getRequestPath()
        var app=new Vue({
            el:"#app",
            data:{
                
                payWay:0
            },
            methods:{
                openMembershipByUserId: function () {
                    axios.post(path+"/SuperMemberController/openMembershipByUserId",null,{
                        params:{},
                        headers:{
                            Authorization:this.getAuthorization()
                        }
                    }).then((respon)=>{
                        if(respon.data.code==200){
                            this.jumpTo("index.html")
                            alert("已开通")
                        }
                    }).catch((error)=>{
                        console.log(error)
                    })
                },
                getAuthorization:function(){
                    return window.localStorage.getItem("Auth")
                },
                jumpTo:function(u){
                    
                    window.location.href=u
                },
            },
            created(){
                
            }
        })
    </script>
</body>
</html>